<script type="text/javascript">
    var aktif = false;

    function proses() {
        var k = $('#id_karyawan_pk').val();
        if (k != '') {
            aktif = true;
            console.log("Proses");
            reloadTabelSpesifikasi();
        } else{
            $.messager.alert('Info','Silahkan pilih karyawan terlebih dahulu!','info');
        }
    }

    // function profileKaryawan(){
    //     loadPage(gs_path + '/hrd_karyawan/edit/?id_karyawan_pk='+$('#id_karyawan_pk').getval());
    // }

    $(document).ready(function() {
        // Setup Form
        $('#form_master').setupForm([
            { name: 'nama_karyawan', type: 'text', size:'medium' },
            { name: 'gaji', type: 'text', size:'medium' },
            { name: 'id_karyawan_pk', type: 'lov', size: 'short',
                onClearButton:function(){
                    $(this).setval(''); 
                    $('#nama_karyawan').setval(''); 
                    $('#gaji').setval(''); 
                    reloadTabelSpesifikasi();
                },
                onActionButton:function(){ 
                    LOVHrdKaryawan({ onSelect:function(row){ 
                        $('#id_karyawan_pk').setval(row.id_karyawan_pk); 
                        $('#nama_karyawan').setval(row.nama_karyawan); 
                        $('#gaji').setval(row.gaji); 
                        reloadTabelSpesifikasi();
                    } });
                }
            },
        ], 
            <?php echo json_encode($data); ?>
        );

        
        $('#nama_karyawan').readonly();
        $('#gaji').readonly();

        // Set Action Button
        /*var buttons = [
                        { 
                            label: 'Save', icon: 'save', onclick: function() { 
                                var k = $('#id_karyawan_pk').val();
                                if (k != '') {
                                    console.log("simpan Berhasil"); 
                                } else{
                                    $.messager.alert('Info','Silahkan pilih karyawan terlebih dahulu!','info');
                                }
                            } 
                        }
                      ];
        setAction(buttons);*/
        
        // Create Tab
        $('#tt').tabs({ border:false });  
        
        // Focus at First Object
        $('#form_master').focusFirst();

        // JANGAN LUPA DI HAPUS
        // proses();

    });
</script>

<div id="form_master_message" style="display:none;"></div>
<fieldset style="width:500px;">
<table class="tb_form" style="display:none; width:100%; " cellpadding="0" cellspacing="0" border="0">   
    <!-- <tr>
        <td class="label">NIK</td>
        <td><input id="id_karyawan_pk" /> <button class="easyui-linkbutton" iconCls="icon-edit" onclick="profileKaryawan()">Profile</button></td>
        <td colspan="2" rowspan="8"><img src="/primkokas/files/people.png" width="150" height="200" border="3" style="float:right;"> </td>
    </tr> -->
    <tr>
        <td class="label">NIK</td>
        <td><input id="id_karyawan_pk" /></td>
        <!-- <td colspan="2" rowspan="8"><img src="/primkokas/files/people.png" width="125" height="150" border="3" style="float:right;"> </td> -->
    </tr>
    <tr>
        <td class="label">Nama Karywan</td>
        <td><input id="nama_karyawan" /></td>
    </tr>
    <tr>
        <td class="label">Poin Gaji</td>
        <td><input id="gaji" /></td>
    </tr>
    <!-- <tr>
    	<td></td>
    	<td><button class="easyui-linkbutton" iconCls="icon-reload" onclick="proses()">Proses</button></td>
    </tr> -->
</table>
</fieldset>
<br><br>

<div id="tt" class="easyui-tabs" style="min-height:400px;"> 

    <div title="Spesifikasi" style="overflow:auto;padding:10px;">  
        <?php require_once('detail_spesifikasi.php'); ?>
    </div> 
    
</div>